package com.lovo.game;


import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * 玩家类
 */
public class Player extends Role {
    public int guess() {
        Scanner scan = new Scanner(System.in);

        System.out.println("请猜拳：0石头，1剪刀，2布");
        while (true) {
            try {
                int number = scan.nextInt();
                if (number < 0 || number > 2) {
                    System.out.println("输入错误，请重新猜拳");
                } else {
                    return number;
                }
            } catch (Exception e) {
                System.out.println("输入错误，请重新猜拳");
                scan.next();
            }
        }


    }
}